﻿@model PostListViewModel
@foreach (var post in Model.Items)
{
    @Html.Partial("~/Views/Post/Details.cshtml", post)
}
@if (Model.MaxPage > 1)
{
    <article id="post-pagination">
        <div class="newer">
            @if (Model.Page > 1)
            {
                if (Model.Page != 2)
                {
                    @Html.ActionLink("Newer Posts", "Index", new { page = Model.Page - 1 })
                }
                else
                { 
                    @Html.ActionLink("Newer Posts", "Index")
                }
                <span>&nbsp;&rArr;</span>
            }
        </div>
        <div class="older">
            @if (Model.Page < Model.MaxPage)
            {
                <span>&lArr;&nbsp;</span>@Html.ActionLink("Older Posts", "Index", new { page = Model.Page + 1 })
            }
            else
            {
                <span>&nbsp;</span>
            }
        </div>
    </article>
}